<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Pool Lookup</title>
<script type="text/javascript">
$(document).ready(function(e) {
	var table = $('#listPools').DataTable({
		"bInfo": false,
		"bServerSide" : false,
		"sAjaxSource" : "../../pool/listJSON",
		"aoColumns" : [ {
			"mData" : "questionPoolId",
			"sTitle" : "Id",
			"width": "5%",
			"visible": false
		}, {
			"mData" : "questionPoolName",
			"width": "10%",
			"mRender" : function(name, type, row){
				return '<a href="../../pool/detail/'+row.questionPoolId+'">'+name+'</a>';
			}
		}, {
			"mData" : "description",
			"width": "50%"
		} ]
	});
	
	
	
	$('table tbody').on( 'click', 'tr', function () {
        if ( $(this).hasClass('selected') ) {
            $(this).removeClass('selected');
        }
        else {
            table.$('tr.selected').removeClass('selected');
            $(this).addClass('selected');
            
            var id = table.row( this ).data().questionPoolId;
            var name = table.row( this ).data().questionPoolName;
            $("#poolName").text(name);
            $("#poolId").text(id);
        }
    } );
});
</script>
</head>
<body>
<table style="border-collapse: inherit; border-spacing:inherit;" id="listPools" class="hover table table-striped table-bordered"
				cellspacing="0" style="width: 100%;">
				<thead>
					<tr>
						<th>Id</th>
						<th>Name</th>
						<th>Description</th>
					</tr>
				</thead>
			</table>
			<h6 id="poolName" class="hidden"></h6>
			<h6 id="poolId" class="hidden"></h6>
</body>
</html>